package com.blacktry.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.blacktry.pojo.Book;
import com.blacktry.mapper.BookMapper;
import com.blacktry.pojo.Lend;
import com.blacktry.service.BookService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author blackTry
 * @since 2021-01-31
 */
@Service
public class BookServiceImpl extends ServiceImpl<BookMapper, Book> implements BookService {

    @Autowired
    private BookMapper bookMapper;

    @Override
    public Page<Book> selectPage(Integer currentPage, Integer size) {
        Page<Book> page = new Page<>(currentPage, size);
        return bookMapper.selectPage(page,null);
    }

    @Override
    public Page<Book> selectCanPage(Integer currentPage, Integer size) {
        Page<Book> page = new Page<>(currentPage, size);
        QueryWrapper<Book> wrapper = new QueryWrapper<>();
        wrapper
                .gt("leisure","0");
        return bookMapper.selectPage(page, wrapper);
    }
}
